package de.baumann.browser.activitys.gg

import android.content.Context
import android.content.Intent
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import de.baumann.browser.R
import de.baumann.browser.adapter.SmeltersAdapter
import de.baumann.browser.api.net.vo.gg.Smelter
import de.baumann.browser.base.BaseOdinActivity
import de.baumann.browser.base.BasePresenter
import de.baumann.browser.iview.IBaseView
import de.baumann.browser.iview.gg.ISmeltersView
import de.baumann.browser.present.gg.SmeltersPresenter
import kotlinx.android.synthetic.main.activity_smelters.*
import kotlinx.android.synthetic.main.include_tool_bar.*

class SmeltersActivity : BaseOdinActivity<ISmeltersView, SmeltersPresenter>(),ISmeltersView {


   companion object {
       fun startSmeltersActivity(context: Context){
           context.startActivity(Intent(context,SmeltersActivity::class.java))
       }
   }
    private lateinit var smeltersAdapter: SmeltersAdapter

    override fun getLayout(): Int {
        return R.layout.activity_smelters
    }

    override fun getTitleText(): String {
        return "Smelters"
    }
    override fun initView() {
        initToolbar(commToolBar,commTitle)
        smeltersAdapter = SmeltersAdapter()
        rvSmelters.adapter = smeltersAdapter
    }

    override fun initData() {
        presenter.smelteryRank()
    }

    override fun createPresenter(): SmeltersPresenter {
        return SmeltersPresenter()
    }

    override fun createView(): ISmeltersView {
        return this
    }

    override fun setSmelters(list: List<Smelter>) {
        smeltersAdapter.setNewData(list)
    }

}